#ifndef KONTRAHENT_BASE_H
#define KONTRAHENT_BASE_H

#include <QString>
#include <odb/core.hxx>
#include <odb/qt/lazy-ptr.hxx>
#include "Adres_BASE.h"
#include "Telefon_BASE.h"
#include <QList>
#include <QDate>
#include <QWeakPointer>
#include "Grupa_Kontrahent_BASE.h"
#include "Grupa_Rabat_BASE.h"
#include "Faktura_BASE.h"

class Adres_BASE;
class Telefon_BASE;
class Grupa_Kontrahent_BASE;
class Grupa_Rabat_BASE;
class Faktura_BASE;

#pragma db object
class Kontrahent_BASE{

protected:
    Kontrahent_BASE()
    {
    }

    friend class odb::access;

#pragma db id auto
    unsigned long id;

#pragma db value_not_null inverse(kontrahent_)
    QList < QWeakPointer < Adres_BASE > > adresy_;

#pragma db value_not_null inverse(kontrahent_)
    QList < QWeakPointer < Telefon_BASE > > telefony_;
#pragma db value_not_null inverse(kontrahent_)
    QList < QWeakPointer < Faktura_BASE > > faktury_;
#pragma db value_not_null inverse(kontrahenci_)
    QList < QLazyWeakPointer < Grupa_Kontrahent_BASE > > grupy_Kontrahenta_;


#pragma db not_null type("VARCHAR(150)")
    QString     nazwa_;
#pragma db null type("VARCHAR(40)")
    QString     regon_;
#pragma db type("VARCHAR(20)")
    QString     nip_;
    QDate       data_Wprowadzenia_;
#pragma db null type("VARCHAR(200)")
    QString     nazwa2_;
#pragma db null type("VARCHAR(40)")
    QString     nazwa_Skrocona;
    int         maks_Zaleglych_Platnosci;
#pragma db null type("VARCHAR(25)")
    QString     nr_Konta;
#pragma db null type("VARCHAR(250)")
    QString     email;
#pragma db null type("VARCHAR(250)")
    QString     www;

#pragma db null
    QLazySharedPointer < Grupa_Rabat_BASE > grupa_Rabatowa_;
};

#endif // KONTRAHENT_BASE_H
